/**
 * 
 */
package com.uit.project.bustrip.dao;

import org.json.JSONException;
import org.json.JSONObject;
import android.util.Log;

import com.uit.project.bustrip.daointerface.PointDao;
import com.uit.project.bustrip.database.DBHelper;
import com.uit.project.bustrip.entity.Point;
/**
 * @author Nguyen
 *
 */
public class PointDaoImpl extends BaseDaoImpl<Point, Integer> implements PointDao {

	public PointDaoImpl(){
		super();
	}
	public PointDaoImpl(DBHelper db) {
		super(db);
	}
	@Override
	public Point getFromJSON(JSONObject json) {
		try {
			Point item = new Point();
			item.id = json.getInt("id");
			item.pointname = json.getString("name");
			item.tripCode = json.getString("tcode");
			item.routeCode = json.getString("rcode");
			item.position = json.getInt("position");
			item.status = json.getInt("status");
			return item;
		} catch (JSONException e) {
			Log.i("PointDaoImpl",e.getMessage());
			return null;
		}
	}
}
